-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: split main otel config into multiple connections, add tests #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5e95cdb
to
cd22dc3
Compare
|
||
var configYaml, configMapstructure config.AgentConfig | ||
|
||
// Decode via mapstrucutre (which is how viper does it) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit typo mapstructure
}, | ||
[]CollectorConfigFragment{ | ||
{ | ||
enabledCheck: func(agentConfig *config.AgentConfig) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are basically the shared components between other connection types right? so if we add more connection types we'd need to add them to this check here too? any reason to not just always include this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. I was thinking it would be nice to have a total noop mode (ie operate exactly like a vanilla otelcol
), but it's probably not worth the extra complexity here. I changed this to always return true.
}, | ||
{ | ||
enabledCheck: func(agentConfig *config.AgentConfig) bool { | ||
return agentConfig.Forwarding.Enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before there was no value here right? so if we change this to be default off, that's a breaking change I think. Same for the healthcheck below. do these default to on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These do default to on, but it happens via defaulting the Enabled variable to true in the config definition. I added "default" struct tags to config.AgentConfig
and the go-defaults
library to set them. The new TestAgentConfigFromViper
validates that this works as intended.
57a420f
to
f9fce4b
Compare
f9fce4b
to
0e7e577
Compare
Description
OB-36266: Split main otel config into multiple connections. Use the agent config object as the source of truth instead of viper. Add tests.
I also tested this with the new
observe-agent config --render-otel
command. I enabled all options in my agent config, and diffed the output betweenmain
and this branch and only these lines changed:This is expected since the otel-collector.yaml file no longer exists.
Checklist